package com.tl.boot.common.enums;

/**
 * com.tl.boot.common.enums -- BooleanEnum
 * Description:
 * Created by joshua_liu <a href="mailto:joshualwork@163.com"></a>
 * On 2019/9/16 14:27
 */
public enum BooleanEnum {
    TRUE(1),
    FALSE(0),
    ;
    private Integer code;

    BooleanEnum(Integer code) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public static BooleanEnum getInstanceByCode(Integer code) {
        for (BooleanEnum booleanEnum : BooleanEnum.values()) {
            if (booleanEnum.getCode().equals(code)) {
                return booleanEnum;
            }
        }
        return null;
    }
}
